package com.wfy.service.impl;

import com.wfy.entity.Response;
import com.wfy.entity.ResponseMessage;
import com.wfy.entity.User;
import com.wfy.entity.UserInfo;
import com.wfy.mapper.UserMapper;
import com.wfy.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service(value = "userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }

    @Override
    public Response isLogin(String userName, String passWord) {
        Response response = new Response();
        List<UserInfo> userInfoList = userMapper.getUserInfo(userName, passWord);
        if (userInfoList != null && userInfoList.size() > 0) {
            response.setStatus(ResponseMessage.SUCCESS_CODE);
            response.setMessage(ResponseMessage.SUCCESS_MSG);
        } else {
            response.setStatus(ResponseMessage.EXCEPTION_CODE);
            response.setMessage(ResponseMessage.FAIL_MSG);
        }
        return response;
    }

    @Override
    public void register() {

    }
}
